/**
 * All the functions needed for the static objects
 *
 * Originally written by: Jonas Strandstedt
 *
 * Note: I have thought of remaking so this list only contains velocity and mass etc and 
 * a link to another list containing all the meshes and textures so there are no duplicates
 */


/**
 * player_whirlpool flushed the played down
 */
void player_whirlpool(PlayerObject *player,CollisionObject *obj) {
	if (player->effect == 0) {
		printf("%s has schwooouuuped down the drain!",player->identifier);
		player->effect = PLAYER_EFFECT_WHIRL_POOL;
		player->death++;
	}
}

/**
 * player_sink causes the player to sink regularly
 */
void player_sink(PlayerObject *player,CollisionObject *obj) {
	if (player->effect == 0) {
		printf("%s has sunk!",player->identifier);
		player->effect = PLAYER_EFFECT_SINK;
		player->death++;
	}
}

/**
 * player_explode explodes the player
 */
void player_explode(PlayerObject *player,CollisionObject *obj) {
	if (player->effect == 0) {
		printf("%s has experienced a massive explosion!",player->identifier);
		player->effect = PLAYER_EFFECT_EXPLODE;
		player->death++;
	}
}

/**
 * player_explode explodes the player
 */
void object_switcher(PlayerObject *player,CollisionObject *obj) {
	if (obj->model == 0) {
		obj->model = 1;
	} else {
		obj->model = 0;
	}

}

void powerup_lifebox(PlayerObject *player,CollisionObject *obj) {
	if (obj->lastCollision == 0) {
		if (player->life < 50) {
			player->life += 50;
		} else if (player->life < 100) {
			player->life = 100;
		} else {
			player->life = 130;
		}

		obj->lastCollision = 1000;
		obj->visible = 0;
	}
	
}

void powerup_cannon(PlayerObject *player,CollisionObject *obj) {
	if (obj->lastCollision == 0) {
		player->weapon = WEAPON_CANNON;
		player->ammo = 20;
		obj->lastCollision = 1000;
		obj->visible = 0;
	}
	
}

void powerup_mine(PlayerObject *player,CollisionObject *obj) {
	if (obj->lastCollision == 0) {
		player->weapon = WEAPON_MINE;
		player->ammo = 5;
		obj->lastCollision = 1000;
		obj->visible = 0;
	}
	
}

void powerup_swirlbomb(PlayerObject *player,CollisionObject *obj) {
	if (obj->lastCollision == 0) {
		player->weapon = WEAPON_SWIRLBOMB;
		player->ammo = 5;
		obj->lastCollision = 1000;
		obj->visible = 0;
	}
	
}